import $http from "@/util/HttpRequestUtil";
//统一管理接口url
enum API {
  // 获取加密key接口
  URL_GET_ENCRYPT = "/login/getEncryptedString",
  // 处理登录接口
  URL_HANDLE_LOGIN = "/login/handleLogin",
  //退出接口
  URL_HANDLE_LOGOUT = "/login/handleLogout",
  // 登录成功后获取菜单接口
  URL_GET_MENU = "/login/getMenu",
}

/**
 * 获取加密key
 */
export const getEncryptedString = () =>
  $http<any, any>({
    url: API.URL_GET_ENCRYPT,
    method: "GET",
  });

/**
 * 登录方法
 */
export const login = (params: any) =>
  $http<any, any>({
    url: API.URL_HANDLE_LOGIN,
    method: "POST",
    data: params,
    headers: {
      "Content-Type": "application/json",
    },
  });

/**
 * 退出接口
 */
export const logout = () =>
  $http<any, any>({
    url: API.URL_HANDLE_LOGOUT,
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
  });

/**
 * 获取菜单
 */
export const getMenu = () =>
  $http<any, any>({
    url: API.URL_GET_MENU,
    method: "POST",
    data: {},
    headers: {
      "Content-Type": "application/json",
    },
  });
